<html xmlns="http://www.w3.org/1999/html">
<head>
<#--<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js" type="text/javascript"></script>-->
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.js"></script>
    <script src="//cdn.jsdelivr.net/sockjs/1.1/sockjs.min.js" type="text/javascript"></script>
    <script src="https://cdn.bootcss.com/jsSHA/2.3.1/sha_dev.js"></script>
    <script src="centrifuge.min.js" type="text/javascript"></script>
</head>
<body>
msg:</br>
<script type="text/javascript">
    console.log("start...");
    var userId = "3";
    var secret = "";
    var timestamp = parseInt(new Date().getTime() / 1000).toString();
    var hmacBody = userId + timestamp;
    var shaObj = new jsSHA("SHA-256", "TEXT");
    shaObj.setHMACKey(secret, "TEXT");
    shaObj.update(hmacBody);

    var token = shaObj.getHMAC("HEX");

    console.log("start... userId:" + userId + " secret:" + secret + " timestamp:" + timestamp + " token:" + token);

    var centrifuge = new Centrifuge({
        url: 'http://localhost:8000/connection',
        user: userId,
        timestamp: timestamp,
        token: token
    });

    centrifuge.subscribe("user", function (message) {
        console.log(message);
    });
    centrifuge.connect();

</script>

</body>
</html>